#!/bin/bash

set -e
set -x

# yum install -y --downloadonly --downloaddir=. elasticsearch
bypy download elasticsearch-7.17.26-x86_64.rpm
yum -y --disablerepo='*' localinstall elasticsearch-7.17.26-x86_64.rpm
cp elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
chown -R elasticsearch:elasticsearch /etc/elasticsearch
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch
systemctl daemon-reload
systemctl start elasticsearch.service
curl http://127.0.0.1:9200

set +x
set +e